

const sequelize = require('../db/sequelize')

const { DataTypes } = require('sequelize')

const Address = sequelize.define("nk_addr", {
    // id 自动创建
    consignee: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '收货人姓名'
    },
    user_id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        comment: '用户ID'
    },
    phone: {
        type: DataTypes.CHAR(11),
        allowNull: false,
        comment: '收货人手机号'
    },
    address: {
        type: DataTypes.STRING,
        allowNull: false,
        comment: '收获地址'
    },
    is_default: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: false,
        comment: '默认地址(0:不是1是)'
    }
}, {
    timestamps: true,//时间戳字段
    // paranoid: true,
},)

// 强制 删除并创建表
// Address.sync({ focus: true })

module.exports = Address